<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>getClass封装，重点测试ie兼容性</title>
</head>
<body>
<ul id="ul1">
	<li class="li_box">我是li</li>
	<li>我是li</li>
	<li class="li_box">我是li</li>
	<li class="li_box">我是li</li>
	<li>我是li</li>
	<li class="li_box">我是li</li>
	<li class="li_box">我是li</li>
	<li class="li_box">我是li</li>
</ul>
	<script>
	  var boxArr = getClass('ul1','li_box')
    for(var i=0;i<boxArr.length;i++){
        boxArr[i].style.background = "red"
    }
	 function getClass(oParent,clsName){
	 	var oParent = document.getElementById(oParent);
	  var boxArr = new Array();
	  var oElements  = oParent.getElementsByTagName('*');
	  for(var i=0;i<oElements.length;i++){
	      if(oElements[i].className === clsName){
	          boxArr.push(oElements[i]);
	      }
	  }
	  return boxArr;
	 };
	</script>
</body>
</html>